# 配置请求参数
$headers = @{
    "Content-Type" = "application/json"
}

$body = '{"method":"enable_adb","id":"548997379","jsonrpc":"2.0"}'

try {
    # 发送请求
    $response = Invoke-WebRequest -Uri "http://192.168.43.1/api/" -Method POST -Headers $headers -Body $body
    
    # 获取状态码
    $status = $response.StatusCode

    # 显示HTTP状态码
    Write-Output "HTTP Status Code: $status"
}
catch {
    # 如果请求失败，获取错误信息
    $errorMsg = $_.Exception.Message
    $errorStatus = $_.Exception.Response.StatusCode.value__
    
    Write-Output "Error Status: $errorStatus"
    Write-Output "Error Message: $errorMsg"
}
